```html
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>面向对象编程指南 | 技术小馆</title>
    <link href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <link href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            line-height: 1.8;
            color: #333;
        }
        h1, h2, h3, h4, h5, h6 {
            font-family: 'Noto Serif SC', serif;
            font-weight: 600;
        }
        .hero {
            background: linear-gradient(135deg, #6e8efb 0%, #a777e3 100%);
        }
        .code-block {
            background-color: #f8f8f8;
            border-left: 4px solid #6e8efb;
        }
        .card {
            transition: all 0.3s ease;
            box-shadow: 0 4px 6px rgba(0,0,0,0.1);
        }
        .card:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 15px rgba(0,0,0,0.1);
        }
        .feature-icon {
            color: #6e8efb;
            font-size: 2rem;
            margin-bottom: 1rem;
        }
        .example-item {
            border-left: 3px solid #6e8efb;
            transition: all 0.3s ease;
        }
        .example-item:hover {
            background-color: #f5f7ff;
        }
        .footer {
            background-color: #222;
            color: #fff;
        }
    </style>
</head>
<body class="bg-gray-50">
    <!-- Hero Section -->
    <section class="hero text-white py-20 px-4 md:px-0">
        <div class="container mx-auto max-w-5xl text-center">
            <h1 class="text-4xl md:text-5xl font-bold mb-6">面向对象编程指南</h1>
            <p class="text-xl md:text-2xl mb-8 opacity-90">掌握OOP核心概念，构建可维护、可扩展的代码</p>
            <div class="flex justify-center space-x-4">
                <a href="#concepts" class="px-6 py-3 bg-white text-purple-600 rounded-full font-medium hover:bg-gray-100 transition">核心概念</a>
                <a href="#examples" class="px-6 py-3 border-2 border-white text-white rounded-full font-medium hover:bg-white hover:bg-opacity-10 transition">生活案例</a>
            </div>
        </div>
    </section>

    <!-- Main Content -->
    <main class="container mx-auto max-w-5xl px-4 md:px-0 py-12">
        <!-- Introduction -->
        <section class="mb-16">
            <div class="prose max-w-none">
                <p class="text-lg text-gray-700 leading-relaxed">
                    面向对象编程（Object-Oriented Programming，OOP）是一种软件开发方法，它以对象为中心，将数据和操作封装在一起，通过对象之间的交互来实现程序的功能。面向对象的思想强调程序的组件化、可重用性和易维护性。
                </p>
            </div>
        </section>

        <!-- Core Concepts -->
        <section id="concepts" class="mb-16">
            <h2 class="text-3xl font-bold mb-8 text-gray-800 border-b pb-2">核心概念</h2>
            
            <div class="grid md:grid-cols-3 gap-8 mb-12">
                <!-- Encapsulation -->
                <div class="card bg-white rounded-lg p-6">
                    <div class="feature-icon">
                        <i class="fas fa-box"></i>
                    </div>
                    <h3 class="text-xl font-bold mb-3 text-gray-800">封装</h3>
                    <p class="text-gray-600 mb-4">将数据和操作封装在一个类中，对外部隐藏对象的内部细节，提供统一的访问接口。</p>
                    <div class="code-block p-4 rounded text-sm mb-4">
                        <pre><code>class Car {
  private String brand;
  
  public void setBrand(String b) {
    this.brand = b;
  }
}</code></pre>
                    </div>
                </div>
                
                <!-- Inheritance -->
                <div class="card bg-white rounded-lg p-6">
                    <div class="feature-icon">
                        <i class="fas fa-project-diagram"></i>
                    </div>
                    <h3 class="text-xl font-bold mb-3 text-gray-800">继承</h3>
                    <p class="text-gray-600 mb-4">子类可以继承父类的属性和方法，并可以在此基础上进行扩展或修改。</p>
                    <div class="code-block p-4 rounded text-sm mb-4">
                        <pre><code>class Animal { /*...*/ }
class Dog extends Animal {
  // 继承并扩展
}</code></pre>
                    </div>
                </div>
                
                <!-- Polymorphism -->
                <div class="card bg-white rounded-lg p-6">
                    <div class="feature-icon">
                        <i class="fas fa-random"></i>
                    </div>
                    <h3 class="text-xl font-bold mb-3 text-gray-800">多态</h3>
                    <p class="text-gray-600 mb-4">不同类的对象可以对同一消息做出不同的响应，即同一个方法在不同对象中具有不同的行为。</p>
                    <div class="code-block p-4 rounded text-sm mb-4">
                        <pre><code>Animal a = new Dog();
a.speak(); // 调用Dog的实现</code></pre>
                    </div>
                </div>
            </div>

            <!-- Class and Object -->
            <div class="bg-white rounded-lg shadow-md p-6 mb-8">
                <h3 class="text-2xl font-bold mb-4 text-gray-800">类和对象</h3>
                <div class="prose max-w-none">
                    <p>类是对象的模板或蓝图，定义了对象的结构和行为。对象是类的实例，是具体存在的实体。</p>
                    
                    <div class="grid md:grid-cols-2 gap-8 mt-6">
                        <div>
                            <h4 class="text-lg font-semibold mb-3">类 (Class)</h4>
                            <ul class="list-disc pl-5 space-y-2">
                                <li>抽象数据类型</li>
                                <li>描述具有相同属性和行为的对象集合</li>
                                <li>包含成员变量和方法</li>
                            </ul>
                        </div>
                        <div>
                            <h4 class="text-lg font-semibold mb-3">对象 (Object)</h4>
                            <ul class="list-disc pl-5 space-y-2">
                                <li>类的实例化</li>
                                <li>具体存在的实体</li>
                                <li>具有唯一的标识符</li>
                            </ul>
                        </div>
                    </div>
                    
                    <div class="mt-6">
                        <div class="code-block p-4 rounded text-sm">
                            <pre><code>// 定义类
class Car {
  String color;
  
  void drive() { /*...*/ }
}

// 创建对象
Car myCar = new Car();
myCar.color = "Red";
myCar.drive();</code></pre>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Mermaid Diagram -->
            <div class="bg-white rounded-lg shadow-md p-6 mb-8">
                <h3 class="text-2xl font-bold mb-4 text-gray-800">OOP概念关系图</h3>
                <div class="mermaid">
                    classDiagram
                    class Object{
                        +equals()
                        +toString()
                    }
                    
                    class Class{
                        +attributes
                        +methods()
                    }
                    
                    class Inheritance{
                        +extends
                        +implements
                    }
                    
                    class Encapsulation{
                        +private
                        +public
                        +protected
                    }
                    
                    class Polymorphism{
                        +override
                        +overload
                    }
                    
                    Object <|-- Class
                    Class *-- Inheritance
                    Class *-- Encapsulation
                    Class *-- Polymorphism
                </div>
            </div>
        </section>

        <!-- Examples Section -->
        <section id="examples" class="mb-16">
            <h2 class="text-3xl font-bold mb-8 text-gray-800 border-b pb-2">生活案例</h2>
            
            <div class="space-y-6">
                <!-- Car Example -->
                <div class="example-item bg-white p-6 rounded-lg">
                    <h3 class="text-xl font-bold mb-3 text-gray-800 flex items-center">
                        <i class="fas fa-car mr-2 text-blue-500"></i> 汽车案例
                    </h3>
                    <div class="grid md:grid-cols-2 gap-6">
                        <div>
                            <h4 class="font-semibold mb-2 text-gray-700">类</h4>
                            <p class="text-gray-600">汽车是一个概念，描述了一类具有共同特征和行为的事物。在面向对象编程中，汽车可以被视为一个类，它具有属性（例如颜色、型号、速度）和方法（例如加速、刹车）。</p>
                        </div>
                        <div>
                            <h4 class="font-semibold mb-2 text-gray-700">对象</h4>
                            <p class="text-gray-600">具体的一辆汽车，如一辆红色的丰田轿车。对象是类的一个实例，具有特定的属性值和方法调用。</p>
                        </div>
                    </div>
                </div>
                
                <!-- Student Example -->
                <div class="example-item bg-white p-6 rounded-lg">
                    <h3 class="text-xl font-bold mb-3 text-gray-800 flex items-center">
                        <i class="fas fa-user-graduate mr-2 text-blue-500"></i> 学生案例
                    </h3>
                    <div class="grid md:grid-cols-2 gap-6">
                        <div>
                            <h4 class="font-semibold mb-2 text-gray-700">类</h4>
                            <p class="text-gray-600">学生是一个类，包括了所有在学校接受教育的人。学生类具有共同的属性（如姓名、年龄、班级）和方法（如学习、参加课外活动）。</p>
                        </div>
                        <div>
                            <h4 class="font-semibold mb-2 text-gray-700">对象</h4>
                            <p class="text-gray-600">一个叫小明的学生或者一个叫小红的学生就是学生类的一个对象，具有特定的姓名、年龄和所在班级。</p>
                        </div>
                    </div>
                </div>
            </div>
        </section>

        <!-- Code Examples -->
        <section class="mb-16">
            <h2 class="text-3xl font-bold mb-8 text-gray-800 border-b pb-2">代码示例</h2>
            
            <!-- Student Class Example -->
            <div class="bg-white rounded-lg shadow-md p-6 mb-8">
                <h3 class="text-2xl font-bold mb-4 text-gray-800">学生类实现</h3>
                <div class="code-block p-4 rounded text-sm mb-4 overflow-x-auto">
                    <pre><code>public class Student {
    private String name;
    private int age = 19;  // 默认19
    private String education = "大专";  // 默认大专
    
    // 构造方法
    public Student(String name) {
        this.name = name;
    }
    
    // 设置年龄
    public void setAge(int age) {
        if(age >= 19 && age <= 40) {
            this.age = age;
        } else {
            System.out.println("年龄必须在19-40岁之间");
        }
    }
    
    // 设置学历
    public void setEducation(String edu) {
        if(edu.equals("大专") || edu.equals("本科") || edu.equals("研究生")) {
            this.education = edu;
        } else {
            System.out.println("学历必须是大专、本科或研究生");
        }
    }
    
    // 打印学生信息
    public void printInfo() {
        System.out.println("姓名:" + name + ", 年龄:" + age + ", 学历:" + education);
    }
}</code></pre>
                </div>
            </div>
            
            <!-- Encapsulation Example -->
            <div class="bg-white rounded-lg shadow-md p-6">
                <h3 class="text-2xl font-bold mb-4 text-gray-800">封装示例：学生成绩统计</h3>
                <div class="code-block p-4 rounded text-sm mb-4 overflow-x-auto">
                    <pre><code>public class StudentScore {
    private String name;
    private String gender;
    private int english;
    private int math;
    private int chinese;
    
    // 构造方法
    public StudentScore(String name, String gender) {
        this.name = name;
        this.gender = gender;
    }
    
    // 设置成绩
    public void setScores(int eng, int math, int chi) {
        this.english = eng;
        this.math = math;
        this.chinese = chi;
    }
    
    // 计算总分
    public int getTotal() {
        return english + math + chinese;
    }
    
    // 计算平均分
    public double getAverage() {
        return getTotal() / 3.0;
    }
    
    // 获取最高分
    public int getHighest() {
        return Math.max(Math.max(english, math), chinese);
    }
    
    // 获取最低分
    public int getLowest() {
        return Math.min(Math.min(english, math), chinese);
    }
    
    // 打印学生信息
    public void printInfo() {
        System.out.println("姓名:" + name + ", 性别:" + gender);
        System.out.println("英语:" + english + ", 数学:" + math + ", 语文:" + chinese);
        System.out.println("总分:" + getTotal() + ", 平均分:" + String.format("%.1f", getAverage()));
        System.out.println("最高分:" + getHighest() + ", 最低分:" + getLowest());
    }
}</code></pre>
                </div>
            </div>
        </section>
    </main>

    <!-- Footer -->
    <footer class="footer py-8">
        <div class="container mx-auto max-w-5xl px-4 text-center">
            <h3 class="text-xl font-bold mb-2">技术小馆</h3>
            <p class="text-gray-300">
                <a href="http://www.yuque.com/jtostring" class="hover:text-white transition">http://www.yuque.com/jtostring</a>
            </p>
        </div>
    </footer>

    <script>
        // Initialize Mermaid
        mermaid.initialize({
            startOnLoad: true,
            theme: 'default',
            flowchart: {
                useMaxWidth: false,
                htmlLabels: true
            }
        });
    </script>
</body>
</html>
```